import defaultSettings from '@/settings'

const { showSettings, fixedHeader, sidebarLogo } = defaultSettings

const state = {
  showSettings: showSettings,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  smsType: {
    reg: 1,
    forgotPwd: 2
  },
  uploadType: {
    reg: "regImg",
    news: "news",
    logo: "logo",
    homeBanner: "homeBanner",
    loginBanner: "loginBanner",
    egimg1: "egimg1",
    egimg2: "egimg2",
    egimg3: "egimg3",
    qualificationCertificateFile: "qualificationCertificateFile",
    performanceFile: "performanceFile",
    financialReportFile: "financialReportFile",
    taxFile: "taxFile",
    socialSecurityFile: "socialSecurityFile",
    businessCreditFile: "businessCreditFile",
    otherFile: "otherFile",
    notice: "notice"
  },
  findType: {
    reg: "1",
    storeReview: "2",
    pool: "3",
    pass: "4",
    blacklist: "4",
    pause: "4",
    expire: "6"
  },
  logo: ""
};
/*
logo
sysName
egimg1
egimg2
egimg3
zcbh
rkbh
homebanner
loginbanner
*/
const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value;
    }
  },
  SET_LOGO: (state, logo) => {
    state.logo = logo;
  }
};

const actions = {
  changeSetting({ commit }, data) {
    commit("CHANGE_SETTING", data);
  },
  setLogo({ commit }, data) {
    commit("SET_LOGO", data);
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

